package com.example.charpter05;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import util.DateUtil;

public class ButtonStyleActivity extends AppCompatActivity {

    private TextView tv_result;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_button_style);
//        获取目标id,在整个生命周期中只执行一次
        tv_result = findViewById(R.id.tv_result);//转换成全局属性 ctrl+alt+enter



    }


    public void doClick(View view){
        String desc = String.format("%s 您点击了按钮:  %s",DateUtil.getNowTime(),((Button)view).getText());
        tv_result.setText(desc);

    }
}


















